/*
 * Copyright (c) 2006, 2007 FTS Team
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 4. Neither the name of the FTS Team nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *      InvIndexStorage.hpp
 *
 * $FTS$
 */
#ifndef _INV_INDEX_STORAGE_HPP__
#define _INV_INDEX_STORAGE_HPP__ 1

/**
  @file InvIndexStorage.hpp
  @brief Contains definitions of data storage interface
*/
#include <DocumentEntryIterator.hpp>
#include <Pair.hpp>
#include <ZoneInfo.hpp>

namespace FTSS // FullTextSearchSystem
{

/**
  @class InvIndexStorage InvIndexStorage.hpp <InvIndexStorage.hpp>
  @brief Pure abstract class for data storage interface
*/
class InvIndexStorage
{
public:
	/** A destructor */
	virtual ~InvIndexStorage() throw() { ;; }

	/**
	  @brief Store document entry in specified data storage
	  @param iWordId - Word ID (word hash)
	  @param pEntry - Document Entry
	  @param iDocEntrySize - Document Entry size
	*/
	virtual void StoreDocumentEntry(WordId_t iWordId, DocumentEntry * pEntry, const Size_t & iDocEntrySize) = 0;

	/**
	  @brief Store number of documents in collection
	  @param iIDocNum - Number of documents
	*/
	virtual void StoreDocNum(const Size_t & iIDocNum) = 0;

	/**
	  @brief Get document entry from specified data storage
	  @param iWordId - Word ID (word hash)
	  @return pair of iterators
	*/
	virtual Pair<DocumentEntryIterator, DocumentEntryIterator> GetDocumentEntry(const WordId_t & iWordId) = 0;

	/**
	  @brief Get document frequency for specified token
	  @param iWordId - Word ID (word hash)
	  @return document frequency (number of documents, contains whis word).
	*/
	virtual Size_t GetDF(const WordId_t & iWordId) = 0;

	/**
	  @brief Get number of documents in collection
	  @return Number of documents
	*/
	virtual Size_t GetDocNum() = 0;

	/**
	  @brief Check deletion flag of document
	*/
	virtual INT_32 IsDeleted(const Size_t & iDocNum) = 0;

	/**
	  @brief Get list of all available zones in this document collection
	  @param aZones - list of zones
	  @param iZonesCount - number of zones
	*/
	virtual void StoreZones(const Zone * aZones, const INT_32 & iZonesCount) = 0;

	/**
	  @brief Get list of all available zones in this document collection
	  @param iZonesCount - number of zones
	  @return List of zones
	*/
	virtual Zone * GetZones(INT_32 & iZonesCount) = 0;
};

} // namespace FTSS
#endif // _INV_INDEX_STORAGE_HPP__
// End.
